package com.flaskpy.web.eternity.core.exception;

import cn.hutool.core.annotation.AnnotationUtil;
import com.flaskpy.web.eternity.core.annotation.ExceptionGroup;
import com.flaskpy.web.eternity.core.api.ErrorResponse;
import com.flaskpy.web.eternity.core.exception.abs.IExceptionEnum;
import com.flaskpy.web.eternity.core.exception.enums.BaseExceptionEnum;
import lombok.Getter;
import org.springframework.http.server.reactive.AbstractListenerReadPublisher;

/**
 * @className: BizException
 * @description: 这个人很赖不留下一点说明
 * @author: flaskpy 代码copy大师
 * @date: 2021/6/8
 **/
@Getter
public class BizException extends RuntimeException implements IExceptionEnum {

    private final  IExceptionEnum exceptionEnum;
    public BizException(IExceptionEnum exceptionEnum){
        this.exceptionEnum=exceptionEnum;
    }
    public BizException(){
        this.exceptionEnum= BaseExceptionEnum.UNDEFINED;
    }


    @Override
    public String getCode() {
        return this.exceptionEnum.getCode();
    }

    @Override
    public String getMsg() {
        return this.exceptionEnum.getMsg();
    }
}
